﻿$(function () {
    function GetColorDictionary() {
        $.ajax({
            type: "POST",
            url: "callbacks.aspx/GetColorDictionary",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                var a = response.d;
                var i;
                for (i = 0; i < a.rows; i++)
                    $('#Result').append(
                    a.row[i].color_id + " " +
                    a.row[i].color_code + " " +
                    a.row[i].color_name + "<br>"
                );
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert(xhr.responseText);
            }
        });
    }

    $("#Ehlo").bind("click", GetColorDictionary);

    GetColorDictionary();

});       // End of ready function
